Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArC fixes for spec compatibility, round 3 #30924

Merged
merged 12 commits into from
Feb 8, 2023
Merged

Conversation

Ladicek
Copy link
Contributor

@Ladicek Ladicek commented Feb 6, 2023

Related to #28558

  • fix some bad formatting caused by the move to jakarta
  • add BeanContainer to the set of bean types of the BeanManager built-in bean
  • implement InjectionPoint.isTransient() properly
  • fix resolution of beans with parameterized types with type parameters with multiple bounds
  • validate that producers of normal-scoped beans do not have primitive or array type
  • ignore class-retained annotations everywhere
    • I already attempted to fix issues caused by class-retained annotations once, but the CDI TCK contains tests with some pretty wild class-retained annotations, so this commit addresses that holistically
  • fix BeanManagerImpl.resolveObserverMethods() to return an ordered set per specification
  • validate that bean constructors have no @Disposes, @Observes or @ObservesAsync parameters
  • validate that @Dependent beans don't have conditional observer methods
  • unify and fix handling of transitive stereotypes
  • validate that producer/disposer methods don't have @Observes[Async] parameters
  • deprecate the io.quarkus.arc.Priority annotation
    • jakarta.annotation.Priority can now be put anywhere, so io.quarkus.arc.Priority is not needed anymore

@Ladicek Ladicek requested review from mkouba and manovotn February 6, 2023 14:09
@quarkus-bot quarkus-bot bot added the area/arc Issue related to ARC (dependency injection) label Feb 6, 2023
@Ladicek
Copy link
Contributor Author

Ladicek commented Feb 6, 2023

I know why the tests fail, fix incoming.

@quarkus-bot

This comment has been minimized.

@quarkus-bot

This comment has been minimized.

@Ladicek
Copy link
Contributor Author

Ladicek commented Feb 7, 2023

Not sure why so many checks were skipped 😕 Will rebase and try again.

* This annotation can be used not only on bean classes, but also method and field producers (unlike pure {@code Priority}).
*
* @deprecated Use {@link Alternative} and {@link io.quarkus.arc.Priority}/{@link jakarta.annotation.Priority} instead
* @deprecated Use {@link Alternative} and {@link jakarta.annotation.Priority} instead
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should remove this annotation instead...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be in favor, but ... should we first add a warning that it's deprecated for removal?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it's deprecated since 2.6.0.CR1...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for removal, it was meant as a temporary solution until we can make use of a standard solution anyway.

Copy link
Member

@gsmet gsmet Feb 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it has been deprecated since 2.6, we can remove it. Just make sure you add an entry to the migration guide about how it should be transformed.

@quarkus-bot

This comment has been minimized.

Copy link
Contributor

@manovotn manovotn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few minor comments, most with my QE hat on. Otherwise looks good.

* This annotation can be used not only on bean classes, but also method and field producers (unlike pure {@code Priority}).
*
* @deprecated Use {@link Alternative} and {@link io.quarkus.arc.Priority}/{@link jakarta.annotation.Priority} instead
* @deprecated Use {@link Alternative} and {@link jakarta.annotation.Priority} instead
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for removal, it was meant as a temporary solution until we can make use of a standard solution anyway.

* <p>
* A priority specified by {@link AlternativePriority} and {@link jakarta.annotation.Priority} takes precedence.
*
* @deprecated use {@link jakarta.annotation.Priority} instead
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could log a warning/info for this annotation to help users spot it before we get to removal, WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think anyone looks at the warnings we currently produce, and adding more is just an exercise in futility.

What we could do is fail the build if the annotation is used, but that's a pretty harsh measure :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have done that before and we can just drop the annotation if we document it properly in the migration guide.

It has been deprecated for a long time and in several Quarkus and RHBQ releases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. I don't think this PR is a good vehicle for that, as it affects a few Quarkus core extensions and at least one Quarkiverse extension. I filed #30963 for it.

@quarkus-bot

This comment has been minimized.

@gsmet
Copy link
Member

gsmet commented Feb 8, 2023

CI failures don't look related.

I filled #30988 for the first one and created a PR to disable the MongoDB test on Windows again.

…tive or array type

In theory, this validation should only fail if there's an
injection point that resolves to the bean. However, we do
all similar validations just on the producer declaration;
this commit only follows suit.
This commit fixes handling of transitive stereotypes in these 4 areas:

- inheriting bean scope from stereotypes
- inheriting default bean name status from stereotypes
- inheriting alternative status from stereotypes
- inheriting priority from stereotypes

Previously, some of these areas only looked one level deep into
transitive stereotypes, while others did not consider transitive
stereotypes at all. They are all consistent now.
@manovotn manovotn added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Feb 8, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented Feb 8, 2023

✔️ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

@gsmet gsmet merged commit a7ebe03 into quarkusio:main Feb 8, 2023
@quarkus-bot quarkus-bot bot removed the triage/waiting-for-ci Ready to merge when CI successfully finishes label Feb 8, 2023
@quarkus-bot quarkus-bot bot added this to the 3.0 - main milestone Feb 8, 2023
@Ladicek Ladicek deleted the arc-fixes branch February 8, 2023 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/arc Issue related to ARC (dependency injection)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants